$(document).ready(function(){
	
	var page=$(".right .pages ul li span.page");
	var page=$(".right .pages ul li span.list");
	
	var length=$(".right .pages ul li").length;
	$(".right .pages ul li").each(function(i){
		var l=length-1;
		$(this).click(function(){
			if(i==0)return;
			else if(i!=1&&i!=l){
				$(this).attr("class","selected");
				$(this).siblings().attr("class","");
				$(".right .pages ul li").eq(0).attr("class","total");
				$(".right .pages ul li").eq(1).attr("class","prev");
			}
			else if(i==1){
				var choose=$(".right .pages ul li.selected");
				var text=choose.text();
				text=parseInt(text);
				if(text!=1){
					choose.prev().attr("class","selected");
					choose.attr("class","");
				}
			}
			else if(i==l){
				var choose=$(".right .pages ul li.selected");
				var text=choose.text();
				text=parseInt(text);
				if(text<=l){
					choose.next().attr("class","selected");
					choose.attr("class","");
				}
			}
		});
	});
});